<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JS 基础2</title>
</head>

<body>
    <script>
        var color = 250;
        console.log(color.toString(16));

        var person = {
            'age': 18,
            weight: 100,
            say: function (msg) {
                // do something
                return msg;
            }
        };
        const book = {};
        console.log(person['age']);
        person.age = 19;
        console.log(person.say('hi'));
        console.log(person.age);
        for (var key in person) {
            console.log(key,person[key]);
        }
        //console.log(person[age]);
        var computer = new Object();
        console.log(typeof computer);
        JSON.stringify(typeof computer);
        () => {
            console.log('这是来自匿名函数的信息');
        };

        function plus(a, b) {
            var c = 2020;
            console.log(a + b, c);
        };

          plus(2, 3);
          plus(5);
        var books = ['javascript', 'HTML', '深入css', 'Vue']
        console.log(books.length, books['length'], books[0], books['0']);
        books.push('node');
        console.log(books.length, books[4]);
        delete books[4];
        console.log(books.length, books[4]);


        books.forEach(function (item, key) {
            console.log(item, key);
        });

        var another = books.map(function (item) {
            return item + ' + flag'
        });
        another.forEach(function (item, key) {
            console.log(key, item);
        });
        another.forEach((item, key) => {
            console.log(key, item);
        });
    </script>

</body>

</html>
